#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QThread>
#include <QCryptographicHash>
#include <QFile>
#include <QTextCodec>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QMouseEvent>
#include <QJsonDocument>
#include <QJsonObject>
#include <QDialog>
#include <QLineEdit>
#include <QPushButton>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE
class ThreadRequest : public QObject
{
	Q_OBJECT
public:
	void open_file();
	void get_token_by_login();
	void get_signid_by_token();
	void do_mark_by_signid();
	void logout();

	QNetworkAccessManager * manager;

signals:
	void send_json(QByteArray json);
public slots:
	void wait_account_mark(QString phone, QString pwd);

protected:
	QString deviceToken;
	QString token;
	QString phone;
	QString password;
	QString singid;
};

class Widget : public QWidget
{
	Q_OBJECT

public:
	Widget(QWidget *parent = nullptr);
	~Widget();
	void start_thread();

signals:
	void send_account(QString phone, QString password);

private slots:
	void on_pushButton_mark_clicked();

	void on_pushButton_login_clicked();

private:
	Ui::Widget *ui;
	QThread *thread;
	QDialog *dlg;
	QString lng,lat,loc;

public slots:
		void wait_json(QByteArray json);

};
#endif // WIDGET_H
